﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Moonwish.Silverlight.OsAvatar.Utility
{
    /// <summary>
    /// 开始程序菜单树高度转换器。
    /// by zhlin 2011-12-04
    /// </summary>
    public class HeightFormatter : IValueConverter
    {
        // Methods
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                return (((double)value) - 45.0);
            }
            catch (Exception)
            {
                return value;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (((double)value) + 45.0);
        }
    }
}
